package com.kk.netty.nio.demo;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import static com.kk.netty.nio.ByteBufferUtil.debugAll;

public class TestButeBufferApi {
    public static void main(String[] args) {
        ByteBuffer buffer1 = StandardCharsets.UTF_8.encode ("你好");
        ByteBuffer buffer2 = Charset.forName ("utf-8").encode ("你好");

        debugAll (buffer1);
        debugAll (buffer2);

        CharBuffer buffer3 = StandardCharsets.UTF_8.decode (buffer1);
        System.out.println (buffer3.getClass ( ));
        System.out.println (buffer3.toString ( ));
    }
}
